package problem2697;

//2697.字典序最小回文子串
//https://leetcode.cn/problems/lexicographically-smallest-palindrome/description/?envType=problem-list-v2&envId=two-pointers

class Solution {
    public String makeSmallestPalindrome(String s) {
        char[] str = s.toCharArray();
        int l = 0, r = str.length-1;
        while(l < r) {
            if(str[l] != str[r]) {
                if(str[l] < str[r]) str[r] = str[l];
                else str[l] = str[r];
            }
            l++; r--;
        }
        return new String(str);
    }
}